--[[
	Project:		TruRP
	Author:			Martin 'Ploo' Pucilowski
	File:			occupations.lua
	Date:			02/2010
	Description:	
--]]

TRU.Occupations = {  }
TRU.CitizenModels = {  }

local function AddOccupation(Occupation)
	table.insert( TRU.Occupations, Occupation )
	
	team.SetUp( #TRU.Occupations, Occupation.Name, Occupation.Color )
	return #TRU.Occupations
end

OCCUPATION_CITIZEN = AddOccupation( { 
	Name = "Citizen",
	Color = Color(0,200,0,200),
	Model = "",
	Description = [[A regular citizen, living their life.]],
	Salary = 60,
	Weapons = {  },
	Max = 128,
	Voted = false,
	Demotable = false,
	Occupations = {  },
	Groups = {  },
	Flags = ""
} )
OCCUPATION_ROOKIE = AddOccupation( { 
	Name = "Police Rookie",
	Color = Color(0,0,150,200),
	Model = "models/player/combine_soldier.mdl",
	Description = [[Protects the town from criminals.]],
	Salary = 65,
	Weapons = { "weapon_pistol" },
	Max = 4,
	Voted = false,
	Demotable = true,
	Occupations = {  },
	Groups = {  },
	Flags = ""
} )
OCCUPATION_POLICE = AddOccupation( { 
	Name = "Police",
	Color = Color(0,0,200,200),
	Model = "models/player/combine_soldier_prisonguard.mdl",
	Description = [[Protects the town from criminals.]],
	Salary = 85,
	Weapons = { "weapon_pistol", "weapon_smg1" },
	Max = 4,
	Voted = true,
	Demotable = true,
	Occupations = {  },
	Groups = {  },
	Flags = ""
} )
OCCUPATION_POLICECHIEF = AddOccupation( { 
	Name = "Police Chief",
	Color = Color(0,0,255,200),
	Model = "combine_super_soldier.mdl",
	Description = [[Protects the town from criminals.]],
	Salary = 105,
	Weapons = { "weapon_357", "weapon_ar2" },
	Max = 1,
	Voted = true,
	Demotable = true,
	Occupations = {  },
	Groups = {  },
	Flags = ""
} )
OCCUPATION_MAYOR = AddOccupation( { 
	Name = "Mayor",	
	Color = Color(255,0,0,200),
	Model = "models/player/breen.mdl",
	Description = [[Runs the town.]],
	Salary = 125,
	Weapons = { "weapon_357" },
	Max = 1,
	Voted = true,
	Demotable = true,
	Occupations = {  },
	Groups = {  },
	Flags = ""
} )

--PrintTable( TRU.Occupations )







local function AddCitizenModel( citizen, model )
	table.insert( TRU.CitizenModels, model )
end

local function IsPlayerModelValid( ply, model )
	for _, v in pairs( TRU.CitizenModels ) do
		if v == model then
			return true
		end
	end
end

AddCitizenModel( "models/player/Group01/female_01.mdl" )
AddCitizenModel( "models/player/Group01/female_02.mdl" )
AddCitizenModel( "models/player/Group01/female_03.mdl" )
AddCitizenModel( "models/player/Group01/female_04.mdl" )
AddCitizenModel( "models/player/Group01/female_06.mdl" )
AddCitizenModel( "models/player/Group01/female_07.mdl" )
AddCitizenModel( "models/player/Group03/female_01.mdl" )
AddCitizenModel( "models/player/Group03/female_02.mdl" )
AddCitizenModel( "models/player/Group03/female_03.mdl" )
AddCitizenModel( "models/player/Group03/female_04.mdl" )
AddCitizenModel( "models/player/Group03/female_06.mdl" )
AddCitizenModel( "models/player/Group03/female_07.mdl" )

AddCitizenModel( "models/player/Group01/male_01.mdl" )
AddCitizenModel( "models/player/Group01/male_02.mdl" )
AddCitizenModel( "models/player/Group01/male_03.mdl" )
AddCitizenModel( "models/player/Group01/male_04.mdl" )
AddCitizenModel( "models/player/Group01/male_05.mdl" )
AddCitizenModel( "models/player/Group01/male_06.mdl" )
AddCitizenModel( "models/player/Group01/male_07.mdl" )
AddCitizenModel( "models/player/Group01/male_08.mdl" )
AddCitizenModel( "models/player/Group01/male_09.mdl" )

AddCitizenModel( "models/player/Group03/male_01.mdl" )
AddCitizenModel( "models/player/Group03/male_02.mdl" )
AddCitizenModel( "models/player/Group03/male_03.mdl" )
AddCitizenModel( "models/player/Group03/male_04.mdl" )
AddCitizenModel( "models/player/Group03/male_05.mdl" )
AddCitizenModel( "models/player/Group03/male_06.mdl" )
AddCitizenModel( "models/player/Group03/male_07.mdl" )
AddCitizenModel( "models/player/Group03/male_08.mdl" )
AddCitizenModel( "models/player/Group03/male_09.mdl" )

PrintTable( TRU.CitizenModels )


if not SERVER then return end

function Apply( ply, cmd, args )
	local TeamID = tonumber(args[1])
	ply:SetTeam( TeamID )
	ply:ChatPrint("You are now a " .. Occupations[TeamID]["Name"])
end
concommand.Add("RP_Apply", Apply )